//
//  Message.h
//  HuaZiChatDemo
//
//  Created by huazi on 15-4-2.
//  Copyright (c) 2015年 huifu. All rights reserved.
//

#import <Foundation/Foundation.h>
/**
 *  消息类型  文本、语音、图片、其他（包含一些系统的消息）
 */
typedef NS_ENUM(NSInteger, MessageType){
    MessageTypeText =0,
    MessageTypeVoice =1,
    MessageTypePhoto =2,
    MessageTypeOther =3,
};
/**
 *  消息发送者  自己、好友、系统、其他
 */
typedef NS_ENUM(NSInteger, MessageSender){
    MessageSenderSelf =0,
    MessageSenderFriend =1,
    MessageSenderSystem =2,
    MessageSenderOther =3,
};
/**
 *  消息状态  自己发送状态、接收的消息
 */
typedef NS_ENUM(NSInteger, MessageStatus){
    MessageStatusNormal =0,
    MessageStatusSending =1,
    MessageStatusSendSucceed =2,
    MessageStatusSendFaild =3,
    MessageStatusReceive =4,
    MessageStatusReceiveDownloading =5,
    MessageStatusReceiveDownloadFailed =6,
    MessageStatusReceiveDownloadSucceed =7,
};
@interface Message : NSObject
@property (nonatomic) MessageType type;
@property (nonatomic) MessageSender sender;
@property (nonatomic) MessageStatus status;
@property (strong, nonatomic)NSString *oprId;    //消息持有者
@property (strong, nonatomic)NSString *user_Id;  //与谁聊天
@property (strong, nonatomic)NSString *content;  //text 类型文本内容
@property (strong, nonatomic)NSString *name;     //好友名称
@property (strong, nonatomic)NSString *urlMessage;  //消息下载地址 语音或大图的下载地址
@property (strong, nonatomic)NSString *urlSmallPic; //只有当为图片时，小的图片地址
@property (nonatomic)NSInteger timeLength;
@property (strong, nonatomic)NSString *time;    //消息的发送或接收时间
@property (strong, nonatomic)NSString *filePath;
@property (nonatomic)BOOL isReaded;
@property (nonatomic)BOOL isPlayed;    //仅当消息为音频的情况下，是否已播放过该音频
- (instancetype)initWithReceiveDic:(NSDictionary *)dic;
- (instancetype)initWithSendDic:(NSDictionary *)dic AndMessageType:(MessageType)type;
- (instancetype)initWithDatabaseDic:(NSDictionary *)dic;
@end
